const getAdvertArea = (point, area, ratio) => {
  for (var i = 0; i < area.length; i++) {
    var coords = area[i].coords.split(",");
    var x1 = parseInt(coords[0] * ratio)
    var y1 = parseInt(coords[1] * ratio)
    var x2 = parseInt(coords[2] * ratio)
    var y2 = parseInt(coords[3] * ratio)

    if (point.x >= x1 && point.x <= x2 && point.y >= y1 && point.y <= y2) {
      return area[i]
    }
  }
}

module.exports = {
  getAdvertArea: getAdvertArea
}